Skip to content

Conversation

@cmb69
Copy link
Member

@cmb69 cmb69 commented Feb 2, 2025

The $module_name of com::__construct() can be a ProgID, ClassID or moniker. We first try CLSIDFromString(), and if that fails, we go ahead and try to treat the $module_name as a moniker. If that also fails, we throw an exception with the result of MkParseDisplayName() what would just be MK_E_SYNTAX if given a ProgID. This result is highly confusing for the common case where a ProgID is given, which is not registered (e.g. due to a typo). In this case, we use the original HRESULT (CO_E_CLASSSTRING) instead.

The `$module_name` of `com::__construct()` can be a ProgID, ClassID or
moniker.  We first try `CLSIDFromString()`, and if that fails, we go
ahead and try to treat the `$module_name` as a moniker.  If that also
fails, we throw an exception with the result of `MkParseDisplayName()`
what would just be `MK_E_SYNTAX` if given a ProgID.  This result is
highly confusing for the common case where a ProgID is given, which is
not registered (e.g. due to a typo).  In this case, we use the original
`HRESULT` (`CO_E_CLASSSTRING`) instead.
@cmb69 cmb69 changed the title Improve COM ctr exception code for failing ProgIDs Improve COM ctor exception code for failing ProgIDs Feb 2, 2025
@cmb69 cmb69 merged commit 252b52a into php:master Feb 14, 2025
9 checks passed
@cmb69 cmb69 deleted the cmb/com-ctor-hresult branch February 14, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant